// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
-const { Clutter, GObject, IBus } = imports.gi;
+const { Clutter, GLib, GObject, IBus } = imports.gi;
const Keyboard = imports.ui.status.keyboard;
+var HIDE_PANEL_TIME = 50;
+
var InputMethod = GObject.registerClass(
class InputMethod extends Clutter.InputMethod {
_init() {
this._preeditStr = '';
this._preeditPos = 0;
this._preeditVisible = false;
+ this._hidePanelId = 0;
this._ibus = IBus.Bus.new_async();
this._ibus.connect('connected', this._onConnected.bind(this));
this._ibus.connect('disconnected', this._clear.bind(this));
this._updateCapabilities();
this._emitRequestSurrounding();
}
+
+ if (this._hidePanelId) {
+ GLib.source_remove(this._hidePanelId);
+ this._hidePanelId = 0;
+ }
}
vfunc_focus_out() {
this.set_preedit_text(null, 0);
this._preeditStr = null;
}
+
+ this._hidePanelId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, HIDE_PANEL_TIME, () => {
+ this.set_input_panel_state(Clutter.InputPanelState.OFF);
+ this._hidePanelId = 0;
+ return GLib.SOURCE_REMOVE;
+ });
}
vfunc_reset() {